package com.aliyun.inventory.client.constants;

/**
 * 
 * @date 2024/11/28
 */
public abstract class InventoryCacheKey {

    /**
     * 构建用户已购买数量key
     *
     * @param productId 商品 ID
     * @param userId    用户 ID
     * @return {@link String }
     */
    public static String buildUserPurchasedQuantityKey(long productId, long userId) {
        return "{" + productId + "}:USER_PURCHASED_QUANTITY_" + userId + "_" + productId;
    }

    /**
     * 构建剩余库存key
     *
     * @param productId 商品 ID
     * @return {@link String }
     */
    public static String buildRemainQuantityKey(long productId) {
        return "{" + productId + "}:REMAIN_INVENTORY_" + productId;
    }

    /**
     * 构建库存key
     *
     * @param productId 商品 ID
     * @return {@link String }
     */
    public static String buildInventoryKey(long productId) {
        return "INVENTORY_" + productId;
    }
}
